//
// Created by root on 20-8-9.
//

#ifndef LIBYUV_EXT_CONVERT_H
#define LIBYUV_EXT_CONVERT_H

#include <libyuv/basic_types.h>
#include <libyuv/cpu_id.h>
#include <libyuv/row.h>
#include <string.h>  // For memset.

#if !defined(LIBYUV_DISABLE_NEON) && \
    (defined(__aarch64__) || defined(__ARM_NEON__) || defined(LIBYUV_NEON))
#define HAS_BGR24TOYROW_NEON
#define HAS_BGR24TOUVROW_NEON
#endif

#ifdef __cplusplus
namespace libyuv {
    extern "C" {
#endif

    void BGR24ToYRow_C(const uint8_t *src_rgb, uint8_t *dst_y, int width);
    void BGR24ToUVRow_C(const uint8_t *src_rgb, int src_stride_rgb, uint8_t *dst_u, uint8_t *dst_v, int width);
    // Convert RGBA To NV21.
    LIBYUV_API
    int RGBAToNV21(const uint8_t *src_rgba, int src_stride_rgba,
                   uint8_t *dst_y, int dst_stride_y,
                   uint8_t *dst_vu, int dst_stride_vu,
                   int width, int height);

    // Convert BGRA To NV21.
    LIBYUV_API
    int BGRAToNV21(const uint8_t *src_bgra, int src_stride_bgra,
                   uint8_t *dst_y, int dst_stride_y,
                   uint8_t *dst_vu, int dst_stride_vu,
                   int width, int height);
    LIBYUV_API
    int BGR24ToNV21(const uint8_t *src_bgr, int src_stride_bgr,
                    uint8_t *dst_y, int dst_stride_y,
                    uint8_t *dst_vu, int dst_stride_vu,
                    int width, int height);
    LIBYUV_API
    int ResearchI420ToNV12(const uint8_t *src_y, int src_stride_y,
                           const uint8_t *src_u, int src_stride_u,
                           const uint8_t *src_v, int src_stride_v,
                           uint8_t *dst_y, int dst_stride_y,
                           uint8_t *dst_uv, int dst_stride_uv,
                           int width, int height);
#ifdef __cplusplus
    }  // extern "C"
}  // namespace libyuv
#endif

#endif //LIBYUV_EXT_CONVERT_H
